﻿using System;
using System.ComponentModel.Design;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using CommunityToolkit.Mvvm.Messaging;
using DynamicData;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
using SimpleTool.ActivityUnit;
using SimpleTool.SerialTool.SerialControl;
using SimpleTool.Server;
using SimpleTool.TransformComponent;
using Supabase.Gotrue;
using static SimpleTool.SerialTool.SerialControl.CommandSectionModel;
using static SimpleTool.SerialTool.SerialControl.SerialViewModel;

namespace SimpleTool.SerialTool
{
    /// <summary>
    /// OverViewControl.xaml 的交互逻辑
    /// </summary>
    public partial class OverViewUI : UserControl
    {
        private readonly static ILogger Logger = Log.ForContext<OverViewUI>();

        public OverViewUI()
        {
            InitializeComponent();
            App MyApp = (App)Application.Current;

            OverViewModel HoldViewModel = MyApp.ServiceProvider.GetRequiredService<OverViewModel>();

            DataContext = HoldViewModel;

            HoldViewModel.PowerPlantServer.Read<OverViewModel>(HoldViewModel.SerialDataReceive);
        }
    }
}
